Change in openvpn[master]: Print SSL peer signature information in handshake debug details
A message that is not in the archive (sent off-list or not yet received): gerrit.1696674325000.Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
to review the following change.
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
---
M src/openvpn/ssl_openssl.c
1 file changed, 78 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/1
src/openvpn/ssl_openssl.c +78 -2
@@ -2169,6 +2169,80 @@EVP_PKEY_free (pkey); } +#ifndef LIBRESSL_VERSION_NUMBER +/** +* Translate an OpenVPN NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="" ; +const char *peer_sig_type ="" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } + +#ifndef LIBRESSL_VERSION_NUMBER +/* LibreSSL 3.7.x and 3.8.0 weirdly implment this function but fail on +* linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2183,8 +2257,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2199,8 +2274,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
to look at the new patch set (#2).
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 80 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/2
src/openvpn/openssl_compat.h +1 -0
@@ -117,6 +117,7 @@#define EVP_CIPHER_CTX_reset EVP_CIPHER_CTX_init#define X509_get0_notBefore X509_get_notBefore#define X509_get0_notAfter X509_get_notAfter +#define SSL_get_peer_tmp_key SSL_get_server_tmp_key/** * Reset a HMAC context
src/openvpn/ssl_openssl.c +79 -3
107 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
to look at the new patch set (#5).
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
---
M src/openvpn/ssl_openssl.c
1 file changed, 81 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/5
src/openvpn/ssl_openssl.c +81 -3
@@ -2163,12 +2163,88 @@char pkeybuf[128 ] = {0 };print_pkey_details (pkey, pkeybuf,sizeof (pkeybuf)); -openvpn_snprintf (buf, buflen,", server temp key: %s" , +openvpn_snprintf (buf, buflen,", peer temporary key: %s" , pkeybuf);EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="" ; +const char *peer_sig_type ="" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/* LibreSSL 3.7.x and 3.8.0 weirdly implement this function but fail on +* linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2183,8 +2259,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2199,8 +2276,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 5:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/fd0ca587_1da0ef2f :
PS5, Line 2166: openvpn_snprintf(buf, buflen, ", peer temporary key: %s",
This probably belongs in the previous commit.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Sun, 08 Oct 2023 11:53:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 7:
(2 comments)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/3b343ee7_423d9351 :
PS5, Line 2166: openvpn_snprintf(buf, buflen, ", peer temporary key: %s",
Quoted 1 line
This probably belongs in the previous commit.
Done
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/be8eca11_de41140b :
PS7, Line 2214: const char *peer_sig_type = "";
With libressl or openssl 1.0.2 this will print "" for now. Should we maybe change the default to "UNKNOWN" or something similar? Or would you consider that useless clutter?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 09 Oct 2023 10:43:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
to look at the new patch set (#8).
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
---
M src/openvpn/ssl_openssl.c
1 file changed, 80 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/8
src/openvpn/ssl_openssl.c +80 -2
@@ -2165,6 +2165,82 @@EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="unknown" ; +const char *peer_sig_type ="unknown type" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/* LibreSSL 3.7.x and 3.8.0 weirdly implement this function but fail on +* linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2179,8 +2255,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2195,8 +2272,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 8:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/376c7362_26cd0b0d :
PS7, Line 2214: const char *peer_sig_type = "";
Quoted 1 line
With libressl or openssl 1.0.2 this will print "" for now. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 21 Nov 2023 13:13:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 8: Code-Review-1
(2 comments)
Patchset:
PS8:
Don't like the libressl preprocessor check
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/83effa6a_7262c928 :
PS8, Line 2225: * linking with an unresolved symbol */
Filed https://github.com/libressl/openbsd/issues/147 for it.
Might be better to test for the function explicitly in configure instead of checking for libressl?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Nov 2023 12:39:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 8:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/9c5adb74_39d43e25 :
PS8, Line 2225: * linking with an unresolved symbol */
Quoted 1 line
Filed https://github.com/libressl/openbsd/issues/147 for it. […]
This is a super weird thing that I gave up debugging after 1-2h. The thing compiles as the function is declared in the headers and the C files of LibreSSL but for some reasons the linker does not find the symbol in the libreSSL library. So I gave up on trying to figure what is going on and just pretend that libreSSL does not have this function.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Nov 2023 13:10:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 8:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/b497f219_6ae57c40 :
PS8, Line 2225: * linking with an unresolved symbol */
Quoted 1 line
This is a super weird thing that I gave up debugging after 1-2h. […]
Yeah, as noted in the GitHub issue I found the reason. The function exists and is compiled but is not exported, so the linker can't use it. According to the answer it should be fixed in 3.9.0, but also might be fixed in earlier versions, we will need to see.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Nov 2023 14:21:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
to look at the new patch set (#9).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
---
M src/openvpn/ssl_openssl.c
1 file changed, 81 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/9
src/openvpn/ssl_openssl.c +81 -2
@@ -2166,6 +2166,83 @@EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="unknown" ; +const char *peer_sig_type ="unknown type" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if (!defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL ) \ + || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL ) +/* LibreSSL 3.7.x and 3.8.x implement this function but do not export it +* and fail linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2180,8 +2257,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2196,8 +2274,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 9: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Fri, 09 Feb 2024 11:09:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 9:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/79df6aa1_3de451d9 :
PS8, Line 2225: * linking with an unresolved symbol */
Quoted 1 line
Yeah, as noted in the GitHub issue I found the reason. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Fri, 09 Feb 2024 11:09:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
PATCH v9 1/1 Print SSL peer signature information in handshake debug details
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/365
This mail reflects revision 9 of this Change. Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/ssl_openssl.c +81 -2
@@ -2166,6 +2166,83 @@EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="unknown" ; +const char *peer_sig_type ="unknown type" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if (!defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL ) \ + || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL ) +/* LibreSSL 3.7.x and 3.8.x implement this function but do not export it +* and fail linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2180,8 +2257,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2196,8 +2274,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
[Openvpn-devel] [PATCH applied] Re: Print SSL peer signature information in handshake debug details
Tested on the OpenBSD buildbot (some earlier LibreSSL version) and GHA (different OpenSSL versions). Looks all good. As expected, LibreSSL builds do not provide the new information (neither does mbedTLS), but OpenSSL builds do...
2024-02-09 17:09:00 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA1, peer temporary key: 256 bits ECprime256v1, peer signing digest/type: SHA512 RSA
Your patch has been applied to the master branch.
commit b431721eb1b676f8e1a1cbcf233507d2dd29f846
Author: Arne Schwabe Date: Fri Feb 9 12:10:00 2024 +0100
Print SSL peer signature information in handshake debug details
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28206.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#10) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28206.html
---
M src/openvpn/ssl_openssl.c
1 file changed, 81 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/365/10
src/openvpn/ssl_openssl.c +81 -2
@@ -2166,6 +2166,83 @@EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="unknown" ; +const char *peer_sig_type ="unknown type" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if (!defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL ) \ + || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL ) +/* LibreSSL 3.7.x and 3.8.x implement this function but do not export it +* and fail linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2180,8 +2257,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2196,8 +2274,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Print SSL peer signature information in handshake debug details
This is more SSL debug information that most people do not really need or care about. OpenSSL's own s_client also logs them:
Peer signing digest: SHA256
Peer signature type: ECDSA
The complete message looks like this:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bits RSA, signature: RSA-SHA256, server temp key: 253 bits X25519, peer signing digest/type: SHA256 RSASSA-PSS
or when forcing a specific group via tls-groups X448 with a ECDSA server:
Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bits ECsecp384r1, signature: ecdsa-with-SHA256, server temp key: 448 bits X448, peer signing digest/type: SHA384 ECDSA
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28206.html
---
M src/openvpn/ssl_openssl.c
1 file changed, 81 insertions(+), 2 deletions(-)
src/openvpn/ssl_openssl.c +81 -2
@@ -2166,6 +2166,83 @@EVP_PKEY_free (pkey); } +#if !defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL +/** +* Translate an OpenSSL NID into a more human readable name +* @param nid +* @return +*/ +static const char * +get_sigtype (int nid) +{ +/* Fix a few OpenSSL names to be better understandable */ +switch (nid) + { +case EVP_PKEY_RSA : +/* will otherwise say rsaEncryption */ +return "RSA" ; + +case EVP_PKEY_DSA : +/* dsaEncryption otherwise */ +return "DSA" ; + +case EVP_PKEY_EC : +/* will say id-ecPublicKey */ +return "ECDSA" ; + +case -1 : +return "(error getting name)" ; + +default : +return OBJ_nid2sn (nid); + } +} +#endif /* ifndef LIBRESSL_VERSION_NUMBER */ + +/** +* Get the type of the signature that is used by the peer during the +* TLS handshake +*/ +static void +print_peer_signature (SSL *ssl,char *buf,size_t buflen) +{ +int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; +const char *peer_sig ="unknown" ; +const char *peer_sig_type ="unknown type" ; + +/* Even though these methods use the deprecated NIDs instead of using +* string as new OpenSSL APIs do, there seem to be no API that replaces +* it yet */ +#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + peer_sig =OBJ_nid2sn (peer_sig_nid); + } +#endif + +#if (!defined(LIBRESSL_VERSION_NUMBER ) &&OPENSSL_VERSION_NUMBER >=0x1010000fL ) \ + || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL ) +/* LibreSSL 3.7.x and 3.8.x implement this function but do not export it +* and fail linking with an unresolved symbol */ +if (SSL_get_peer_signature_type_nid (ssl, &peer_sig_type_nid) + && peer_sig_type_nid != NID_undef) + { + peer_sig_type =get_sigtype (peer_sig_type_nid); + } +#endif + +if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) + { +return ; + } + +openvpn_snprintf (buf, buflen,", peer signing digest/type: %s %s" , + peer_sig, peer_sig_type); +} + + +/* ************************************** * * Information functions
@@ -2180,8 +2257,9 @@char s1[256 ];char s2[256 ];char s3[256 ]; +char s4[256 ]; - s1[0 ] = s2[0 ] = s3[0 ] =0 ; + s1[0 ] = s2[0 ] = s3[0 ] = s4[0 ] =0 ; ciph =SSL_get_current_cipher (ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix,
@@ -2196,8 +2274,9 @@X509_free (cert); }print_server_tempkey (ks_ssl->ssl, s3,sizeof (s3)); +print_peer_signature (ks_ssl->ssl, s4,sizeof (s4)); -msg (D_HANDSHAKE ,"%s%s%s" , s1, s2, s3); +msg (D_HANDSHAKE ,"%s%s%s%s" , s1, s2, s3, s4); }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/365?usp=email )
Change subject: Print SSL peer signature information in handshake debug details
......................................................................
Patch Set 10:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/365/comment/14a073b2_79023368 :
PS8, Line 2225: * linking with an unresolved symbol */
Quoted 1 line
Yeah, as noted in the GitHub issue I found the reason. […]
I made the check to be >= LibreSSL as they promised to have this in 3.9.0
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5fc0c4b8f164596681ac5ad73002068ec6de1e5
Gerrit-Change-Number: 365
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Comment-Date: Wed, 14 Feb 2024 12:03:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment